﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit;
using NUnit.Framework;
using System.Diagnostics;
using FileApps.LanguageFeatures;

namespace FileApps.Tests
{
    

    [TestFixture]
    public class LinesOfCodeTestsShortFile
    {

        private void WriteLines(Dictionary<int, string> dict)
        {
            foreach (var item in dict)
            {
                Debug.WriteLine(string.Format("{0:00}: {1}", item.Key, item.Value));
            }
        }

        ILinesOfCode loc = new LinesOfCode(@"C:\Temp\shorttest.cs", new CSharpSpecification());

        [Test]
        public void TotalLinesTest()
        {
            int totalLines = loc.TotalLines;
            Debug.WriteLine(totalLines);
            Assert.That(totalLines, Is.EqualTo(6));
        }

        [Test]
        public void EmptyLinesTest()
        {
            int emptyLines = loc.EmptyLines;
            Debug.WriteLine(emptyLines);
            WriteLines(loc.EmptyLineDictionary);
            Assert.That(emptyLines, Is.EqualTo(1));
        }

        [Test]
        public void BracketLinesTest()
        {
            int bracketLines = loc.BracketLines;
            Debug.WriteLine(bracketLines);
            WriteLines(loc.BracketLineDictionary);
            Assert.That(bracketLines, Is.EqualTo(2));
        }

        [Test]
        public void CommentLinesTest()
        {
            int commentLines = loc.CommentLines;
            Debug.WriteLine(commentLines);
            WriteLines(loc.CommentLineDictionary);
            Assert.That(commentLines, Is.EqualTo(0));
        }

        [Test]
        public void CodeLinesTest()
        {
            int codeLines = loc.CodeLines;
            Debug.WriteLine(codeLines);
            WriteLines(loc.CodeLineDictionary);
            Assert.That(codeLines, Is.EqualTo(3));
        }
    }

    
}
